// 1：回单照片、同步回单照片
// 2：附件
// 3：拒签照片
// 4：公司开票协议
// 5: 签收照片

export const ATTACHMENT_TYPES = {
  RECEIPT_PIC: 1,
  ATTACHMENT: 2,
  REJECT_SIGN_PIC: 3,
  INVOICE_PROTOCOL_PIC: 4,
  SIGN_PIC: 5
};

export const ABOUT_CODES = {
  JUMP_COMBINED_WAYBILL: -10341
};

export const STATUS_CODES = {
  WAIT_DISPATCH: 10,
  PRE_DISPATCH: 11,
  ENTRUSTED: 20,
  WAIT_ACCEPT: 21,
  WAIT_SIGN: 30,
  SIGNING: 31,
  WAIT_RECEIPT: 40,
  RECEIPTED: 50,
  CLOSED: 60,
  DIVIDED: -1
};

import { transportModeKey } from "@components/orderDetail/orderData";

export default {
  props: ["value"],
  computed: {
    waybill () {
      return this.value || this.wayDetails || {};
    },
    customer () {
      return this.waybill?.customer || {};
    },
    consignee () {
      return this.waybill?.consignee || {};
    },
    carrier () {
      return this.waybill?.carrier || {};
    },
    fromAddress () {
      return this.waybill?.fromAddress || {};
    },
    fromContact () {
      return this.waybill?.fromContact || {};
    },
    fromTime () {
      return this.waybill?.fromTime;
    },
    toAddress () {
      return this.waybill?.toAddress || {};
    },
    toContact () {
      return this.waybill?.toContact || {};
    },
    toTime () {
      return this.waybill?.toTime;
    },
    transportRequirement () {
      return this.waybill?.transportRequirement || {};
    },
    waybillPrice () {
      return this.waybill?.waybillPrice || {};
    },
    wayBillColumn () {
      const { transportRequirement } = this.waybill;
      let modeKey = transportModeKey;
      let column = [];
      column.push({
        name: transportRequirement?.transportMode === 1 ? 'less' : 'full',
        label: transportRequirement?.transportMode === 1 ? '零担费' : "整车费",
        type: "text"
      });
      modeKey.forEach(i => {
        if (transportRequirement?.[i.key]) {
          column.push({
            name: i.key,
            label: i.key === 'insure' ? '保险费' : `${i.label}费`,
            type: "text"
          });
        }
      })
      // 是否是个体司机
      if (!this.carrier?.carrierExtraType) {
        column.push({ label: "税费", name: "tax", type: "text" });
      }
      if (this.waybillPrice?.minCost) {
        column.push({ label: "最低费用", name: "minCost", type: 'text' });
      }
      column.push({
        name: "surchargeFee",
        label: "补充费用",
        type: "text"
      }, {
        name: "totalFee",
        label: "总费用",
        type: "total"
      });

      return column;
    }
  }
};
